from sqlalchemy import Column, Integer, String, DateTime

from server.config.database import Base


class DataDirectory(Base):
    """
    数据结果表
    """

    __tablename__ = 't_data_directory'

    id = Column(Integer, primary_key=True, autoincrement=True, comment='主键ID')
    task_type = Column(Integer, comment='2人工上传的文件，5系统扫描的文件，6系统扫描的数据库表，7系统扫描的数据库字段')
    system_name = Column(String(128), default=None, comment='业务系统名称')
    data_owner = Column(String(64), default=None, comment='数据所有者')
    data_manager = Column(String(64), default=None, comment='数据管理者')
    resource_id = Column(Integer, default=None, comment='资源id')
    resource_name = Column(String(64), default=None, comment='资源名称')
    scan_id = Column(String(128), nullable=False, comment='表or字段or文件id')
    file_name = Column(String(255), comment='表名称or文件名称')
    field_name = Column(String(255), comment='字段名称')
    data_category_1 = Column('data_one_type', String(100), default='', comment='数据一级分类')
    data_category_2 = Column('data_one_half_type', String(100), default='', comment='数据二级分类')
    data_category_3 = Column('data_two_type', String(100), default='', comment='数据三级分类')
    data_category_4 = Column('data_three_type', String(100), default='', comment='数据四级分类')
    data_level = Column('data_level_name', String(100), default='', comment='数据级别')
    main_data_type = Column(Integer, default=None, comment='1:已确认的主分类；0不确认的分类')
    create_time = Column(DateTime, default=None, comment='分类分级结果创建时间')
    update_time = Column(DateTime, default=None, comment='分类分级结果更新时间')